﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Warehouse.ErrorCode;
using Warehouse.Domian;

using Warehouse.Api.Write.AllGCotion.Command;

namespace Warehouse.Api.Write.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InventoryController : ControllerBase
    {
        public readonly IMediator mediator;

        public readonly ILogger<InventoryController> logger;

        public InventoryController(IMediator mediator, ILogger<InventoryController> logger)
        {
            this.mediator = mediator;
            this.logger = logger;
        }
        /// <summary>
        /// 添加库存
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> AddInventory(AddInventoryCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 添加基本信息的方法
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddBices(AddBasicCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 添加盘点明细
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddAccount(AccountModelCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
